<?php

function specail_offer_list_page_render() {
    $view = views_get_view('special_offer');
    $view->set_use_pager(true);
    $view->set_items_per_page(10);
    $current_page = isset( $_GET['page'] ) ? $_GET['page'] : 0;
    $view->set_current_page( $current_page );
    $view->execute();

    $data = array();
    foreach ($view->result as &$item) {
        $data[] = node_load($item->nid);
    }

    $html = theme('specail_offer_list', $data);
    $html .= theme('pager');
    return $html;
}

function special_offer_block_data_render($load_number){
    $view = views_get_view('special_offer');
    $view->set_use_pager(true);
    $view->set_items_per_page($load_number);
    $view->set_current_page( 0 );
    $view->execute();

    $data = array();
    foreach ($view->result as &$item) {
        $data[] = node_load($item->nid);
    }

    return $data;
}
?>

